package tarena.emp.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tarena.emp.dao.impl.EmpDaoJdbcImpl;
import tarena.emp.entity.Emp;

public class EmpEdit extends HttpServlet {

	@Override
	protected void service(HttpServletRequest arg0, HttpServletResponse arg1)
			throws ServletException, IOException {
		Emp emp =new Emp();
		int id=Integer.parseInt(arg0.getParameter("id"));
		emp.setId(id);
		emp.setName(arg0.getParameter("name"));
		emp.setHireDate(arg0.getParameter("hireDate"));
		emp.setSal(Double.parseDouble(arg0.getParameter("sal")));
		System.out.println(id+"________________________");
		System.out.println(emp.getName()+"________________________");
		System.out.println(emp.getHireDate()+"________________________");
		System.out.println(emp.getSal()+"________________________");
		if((new EmpDaoJdbcImpl()).update(emp))
		{
			arg1.sendRedirect("emplist");

		}
		else{
			
		}
	
		
	}
	

}
